<template>
  <div class="mod-config">
<!--    <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">-->
<!--      <el-form-item>-->
<!--        <el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>-->
<!--      </el-form-item>-->
<!--      <el-form-item>-->
<!--        <el-button @click="getDataList()">查询</el-button>-->
<!--        <el-button v-if="isAuth('alarmonline:areaalarmonline:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>-->
<!--        <el-button v-if="isAuth('alarmonline:areaalarmonline:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>-->
<!--      </el-form-item>-->
<!--    </el-form>-->
    <el-table
      :data="dataList"
      border
      ref="singleTable"
      highlight-current-row
      @current-change="handleCurrentChange"
      :row-class-name="tableRowClassName"
      :header-cell-style="{background:'#17b3a3',color:'#FFFFFF'}"
      style="width: 100%;">
      <el-table-column
        type="selection"
        header-align="center"
        align="center"
        width="50">
      </el-table-column>
      <el-table-column
        prop="materEntity.mid"
        header-align="center"
        align="center"
        label="物料编号">
      </el-table-column>
      <el-table-column
        prop="materEntity.mname"
        header-align="center"
        align="center"
        label="物料名称">
        <!--        {{dataList[i].areaId}}-->
      </el-table-column>
<!--      <el-table-column-->
<!--        prop="materEntity.standard"-->
<!--        header-align="center"-->
<!--        align="center"-->
<!--        label="物料执行标准">-->
<!--      </el-table-column>-->
      <el-table-column
        prop="posid"
        header-align="center"
        align="center"
        label="入库位置">
      </el-table-column>
      <el-table-column
        prop="mptype"
        header-align="center"
        align="center"
        label="位置类型">
        <template slot-scope="scope">
             <span v-if="scope.row.mptype == 0">
               工堆位
             </span>
          <span v-if="scope.row.mptype == 1">
               托盘
             </span>
        </template>
      </el-table-column>
      <el-table-column
        prop="logtime"
        header-align="center"
        align="center"
        label="入库时间">
      </el-table-column>
      <el-table-column
        prop="empEntity.ename"
        header-align="center"
        align="center"
        label="操作员姓名">
      </el-table-column>
      <el-table-column
        prop="empid"
        header-align="center"
        align="center"
        label="操作员工号">
      </el-table-column>
      <el-table-column
        prop="materEntity.description"
        header-align="center"
        align="center"
        label="备注">
      </el-table-column>
<!--      <el-table-column-->
<!--        fixed="right"-->
<!--        header-align="center"-->
<!--        align="center"-->
<!--        width="150"-->
<!--        label="操作">-->
<!--        <template slot-scope="scope">-->
<!--          &lt;!&ndash;          <el-button type="text" size="small" @click="testTwo">点击</el-button>&ndash;&gt;-->
<!--          <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.areaalarmNo)">修改</el-button>-->
<!--          <el-button type="text" size="small" @click="deleteHandle(scope.row.areaalarmNo)">删除</el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>
  </div>
</template>

<script>

export default {
  name: 'poschangetest',
  data () {
    return {
      dataForm: {
        key: ''
      },
      dataList: [],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListLoading: false,
      dataListSelections: [],
      addOrUpdateVisible: false
    }
  },
  components: {
  },
  mounted () {
    this.getIn()
  },
  // activated () {
  //   this.getIn()
  // },
  methods: {
    //  奇偶行背景色不同
    setCurrent(row) {
      this.$refs.singleTable.setCurrentRow(row);
    },
    handleCurrentChange(val) {
      this.currentRow = val;
    },
    tableRowClassName({row, rowIndex}) {
      if ((rowIndex + 1) % 2 === 0) {
        return 'success-row';
      }
      return '';
    },
    // 获取数据列表
    getIn () {
      this.$http({
        url: this.$http.adornUrl('/poschangetest/poschangetest/testin'),
        method: 'get'
      }).then(({data}) => {
        if (data) {
          this.dataList = data
          console.log(this.dataList)
        } else {
          this.dataList = []
          this.totalPage = 0
        }
        this.dataListLoading = false
        // const test = []
        // for (var i in data) {
        //   test.push(i)
        // }
        // console.log(test)
        // for (var i in arr) {
        //  var obj = arr[i]
        //  // console.log(i)
        //  // console.log(obj)
        // }
        // alert(obj)
      })
    }
  }
}
</script>

<<style lang="scss">
.tr-color-0 {
  background: #f0f0f0;
}
.tr-color-1 {
  background: #fff;
}
.el-table .success-row {
  background: #DFEAF5;
}
</style>
